<?php

if (!isset($this->description['http://xmlns.com/foaf/0.1/depiction'][0]['value'])) {
    // get depiction from tool
    $tool = $this->description['http://lod2.eu/schema/demoOf'][0]['value'];
    $toolInstance = new OntoWiki_Resource($tool, OntoWiki::getInstance()->selectedModel);
    $toolDescription = $toolInstance->getDescription();
    $toolDescription = $toolDescription[$toolInstance->getUri()];
    
    if (isset($toolDescription['http://xmlns.com/foaf/0.1/depiction'][0]['value'])) {
        $this->description['http://xmlns.com/foaf/0.1/depiction'] = array(
            $toolDescription['http://xmlns.com/foaf/0.1/depiction'][0]
        );
    }
}

$templateData = array(
    'title'             => $this->title,
    'resourceUri'       => $this->resourceUri,
    'description'       => $this->description,
    'descriptionHelper' => $this->descriptionHelper,
    'options'           => $this->options
);

$seeAlso = isset($this->description['http://www.w3.org/2000/01/rdf-schema#seeAlso'][0]['value'])
         ? $this->description['http://www.w3.org/2000/01/rdf-schema#seeAlso'][0]['value']
         : null;

?>
<div class="maincontent">
    <div class="section testimonial">
        <h3><a href="<?php echo $this->url($this->resourceUri); ?>"><?php echo $this->title; ?></a></h3>
        <div class="section-content">
            <?php echo $this->partial('lod2/content.phtml', $templateData); ?>
            <?php if ($seeAlso): ?>
                <div>Demo: <a href="<?php echo $seeAlso; ?>">launch demo</a></div>
            <?php endif; ?>
        </div>
    </div>
</div>
